# _*_ coding: UTF-8 _*_
# @Time     : 2022/4/22 9:53
# @Author   : Li Jie
# @Site     : http://www.cdtest.cn/
# @File     : 下拉菜单操作.py
# @Software : PyCharm

from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys


def foo1():
    """

    :return:
    """
    driver = webdriver.Chrome()

    driver.maximize_window()

    driver.get(r"http://news.baidu.com/")

    driver.find_element(By.XPATH, "/html").send_keys(Keys.PAGE_DOWN)

    for i in range(10):
        driver.find_element(By.XPATH, "/html").send_keys(Keys.ARROW_UP)
        time.sleep(1)

    # 组合按键
    driver.find_element(By.XPATH, "/html").send_keys(Keys.CONTROL, 'a')

    time.sleep(2)
    driver.quit()


if __name__ == "__main__":
    foo1()
